package edu.mju.msmservice.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 *  读取application.propertis参数
 * @Author:wyp
 * @Date:2020/8/29 19:45
 * InitializingBean:初始化的时候执行 afterPropertiesSet()
 */
@Component
public class ConstPropertiesUtil implements InitializingBean {

    /**
     *  Value("${}") :读取配置文件OSS参数
     */

    @Value("${aliyun.oss.file.endpoint}")
    private String endpoint;
    @Value("${aliyun.oss.file.keyid}")
    private String keyid;
    @Value("${aliyun.oss.file.keysecret}")
    private String keysecret;
    @Value("${aliyun.oss.file.TemplateCode}")
    private String templateCode;

    /**
     * 公开静态常量
     */
    public static String END_POIND;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String ACCESS_TEMPALTE_CODE;

    @Override
    public void afterPropertiesSet() throws Exception {
        END_POIND = endpoint;
        ACCESS_KEY_ID = keyid;
        ACCESS_KEY_SECRET = keysecret;
        ACCESS_TEMPALTE_CODE = templateCode;
    }
}
